package com.ls.blog.dto;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 分页返回参数
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Recodes <T>{
    /**
     * 当前页
     */
    private Long current;

    /**
     * 总数
     */
    private long total;

    /**
     * 当前长度
     */

    private Integer currentSize;

    /***
     * 总页数
     */
    private Long pages;

    /**
     * 数据
     */
    private List<T> recodes;

    public Recodes(IPage<T> page) {
        this.current = page.getCurrent();
        this.total = page.getTotal();
        this.pages = page.getPages();
        this.recodes = page.getRecords();
    }

    public boolean hasMore;
}
